CSharpTest.Net
EncodeBytes(Byte[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Formatting Namespace > HexEncoding Class > EncodeBytes Method : EncodeBytes(Byte[]) Method

input

Glossary Item Box

Transforms a sequence of characters from '0' - '9' and 'a' - 'f' in the binary values

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function EncodeBytes( _
   ByVal input() As Byte _
) As String
C# 
public static string EncodeBytes( 
   byte[] input
)

Parameters

input

Example

Library/Library.Test/TestHexEncoding.cs

C#Copy Code
byte[] all = new byte[256];
for (int i = 0; i < all.Length; i++)
    all[i] = (byte)i;

Assert.AreEqual(AllHex, HexEncoding.EncodeBytes(all));
Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex)));
Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex.ToUpper())));
VB.NETCopy Code
Dim all As Byte() = New Byte(256) {}
Dim i As Integer = 0
While i < all.Length
    all(i) = DirectCast(i, Byte)
    System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While

Assert.AreEqual(AllHex, HexEncoding.EncodeBytes(all))
Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex)))
Assert.AreEqual(0, BinaryComparer.Compare(all, HexEncoding.DecodeBytes(AllHex.ToUpper())))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys